home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Games Collection 1
/
software vault.zip
/
software vault
/
CDR02
/
DCGAMES1.ZIP
/
NEWGAME.ZIP
/
MERCHANT.SCR
< prev
next >
Wrap
Text File
|
1993-04-01
|
5KB
|
171 lines
!
! Default merchant script..
!
! (c) DC Software, 1992
!
! Pending Enhancements
!
! - I need to create a voice file (.VFL) with voices for this script.
! Look at the 'voice()' entries to see what voices it would play if
! they were available. These voices could even be placed in the
! system's voice file (DCSOUNDS.VFL) in which case the voice command
! should read 'voice( xxxx, 1000 )'.
!
!------------------------------------------------------------------------!
:@TALK ! Talk to the character !
!------------------------------------------------------------------------!
! First, say hello.. !
if NPC.V0 > 0 then
writeln( "Hello ", player.name, ". What brings you back?" );
else
writeln( "Welcome to ", npc.name, ". How may I help you?" );
endif;
! Now, set some variables..
NPC.V0 = 1; ! From know on, remember we've been here
L1 = 0; ! No items have been SOLD to the player
L2 = 0; ! No items have been BOUGHT from the player
! Then start a loop and show a menu..
:LOOP
L3 = select( "Buy", "Sell", "Talk", "Bye" );
on L3 goto BUY, SELL, CHAT;
! ESCape and BYE get's us out of here..
:CSTOP
if L1 = 0 and L2 = 0 then
writeln( "Next time buy something!" );
else
writeln( "It's been a pleasure doing business with you!" );
endif;
STOP;
!
! Player want's to buy something from us..
!
:BUY
L3 = select$( NPC );
if L3 < 0 goto LOOP; ! Nothing.. !
if NPC.BP.VALUE >= GROUP.GOLD then
writeln( "You don't have enough money!");
voice( "Broke" );
else
if npc.bp.type = FOOD and npc.bp.class = NONE then
L10 = 255 - group.food; ! Max food we can carry !
if L10 < npc.bp.count then
L11 = npc.bp.count - L10;
writeln( "You have to carry ", L11, " in your backpack" );
inc( group.food, L10 );
copy( npc.bp, player, L11 ); ! Put L11 foods in the backpack !
if failure then
writeln( "The excess merchandize is placed on the floor" );
drop( npc.bp, - L11 ); ! Negative count means "drop a copy" !
endif;
else
inc( group.food, npc.bp.count );
endif;
else
copy( NPC.BP, PLAYER );
if failure then
! Value of failure is # that DID get moved !
L11 = npc.bp.count - failure;
writeln( L11, " are placed on the floor." );
drop( npc.bp, - L11 ); ! Negative count means "drop a copy" !
endif;
endif;
dec ( GROUP.GOLD, NPC.BP.VALUE );
inc ( L1 ); ! Sold 1 item to the PLAYER !
writeln( "SOLD: ", NPC.BP.COUNT, " ", NPC.BP.NAME, " for ", $NPC.BP.VALUE );
voice( "Sold" );
endif;
goto BUY;
!
! Player want's to sell something to us..
!
:SELL
L3 = select$2( PLAYER, matching ); ! Shows only thing's that I might want to buy !
if L3 < 0 then
if L3 = -2 then ! No items in the player's backpack !
if L2 > 0 then
writeln( "You have no more items to sell." );
voice( "NonLeft" );
else
writeln( "You have no items to sell." );
voice( "NoItems" );
endif;
endif;
if L3 = -3 then ! No items of the type(s) I sell in the backpack !
if L2 > 0 then
writeln( "You have no more items that I would like to buy." );
voice( "NonLeft" );
else
writeln( "You have no items that I would like to buy." );
voice( "NoItems" );
endif;
endif;
goto LOOP;
endif;
! Buy an item at half price (it's used) !
if player.bp.count > 1 then
L10 = getnum( "Sell how many?", 0, player.bp.count );
else
L10 = 1;
endif;
if L10 > 0 then
L4 = (PLAYER.BP.VALUE+1) / 2; ! Price paid for the item.
if L10 > 1 then
writeln( "Here is ", $L4, " for each of your ", L10, " ", PLAYER.BP.NAME, "s" );
else
writeln( "Here is ", $L4, " for your ", PLAYER.BP.NAME );
endif;
voice( "Bought" );
inc( group.gold, L4*L10 ); ! Pay the price
if L10 < player.bp.count then
L11 = player.bp.count;
player.bp.count = L10;
copy( PLAYER.BP, NPC ); ! Copy This Many !
player.bp.count = L11 - L10; ! Leave this many !
else
move( player.bp, npc ); ! Move all of them !
endif;
inc( L2 ); ! Bought 1 item from the player !
endif;
goto SELL;
!
! Handle conversation..
!
:CHAT
writeln( "What would you like to talk about?" );
:CHAT1
L3 = getstr("Name","Buy","Sell","Credit","Job","Bye");
if L3 = -1 then
writeln( "Ok." );
goto LOOP; ! Pressed ESCape !
endif;
! First, see if the keyword typed is in the character's text block !
if dotext( S0 ) goto CHAT1;
! It didn't, so try the predefined ones..
on L3 goto CNAME, BUY, SELL, CCREDIT, CJOB, CSTOP;
! Nope, try a 'DEFAULT' line
if not dotext( "DEFAULT" ) then
writeln( "I don't know anything about that!" );
endif;
goto CHAT1;
:CNAME writeln( "My name is ", NPC.name, "." ); GOTO CHAT1;
:CCREDIT writeln( "No credit sales, sorry!" ); GOTO CHAT1;
:CJOB writeln( "I {buy} and {sell} things!" ); GOTO CHAT1;
! Feel free to expand on this list.. !